-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/cpp overhaul #7
base: dev
Are you sure you want to change the base?
Conversation
…tructors for defining a polynomial with t0 and tf.
…they aren't provided ahead of time.
LANGUAGES CXX | ||
DESCRIPTION "BeBOT Library.") | ||
|
||
add_subdirectory(src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't add_subdirectory here. I would expect you to really only have one or two build targets, a library to link to and maybe an executable, so it's better to just add_library(bebot src/...) here, etc rather than make a mostly redundant CMakeList in src to split across.
set_tf(tf); | ||
} | ||
|
||
void BeBOT::set_cpts(const Eigen::Ref<Eigen::MatrixXd>& cpts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More descriptive naming is good. set_control_points isn't that many more characters. In general, we try to avoid writing C++ like it was C, and the horrible idmtcNmng_cnvns that exist in C shouldnt happen in C++
@@ -0,0 +1,47 @@ | |||
#include <bebot/bebot.hpp> | |||
#include <Eigen/Dense> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eigen is included in the header already
@@ -0,0 +1,47 @@ | |||
#include <bebot/bebot.hpp> | |||
#include <Eigen/Dense> | |||
#include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no IO calls in this file, and there probably shouldn't be direct IO calls. Logging functions if necessary.
|
||
BeBOT(const Eigen::Ref<Eigen::MatrixXd>& cpts); | ||
BeBOT(const Eigen::Ref<Eigen::MatrixXd>& cpts, const double tf); | ||
BeBOT(const Eigen::Ref<Eigen::MatrixXd>& cpts, const double t0, const double tf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the purpose of multiple constructors. What happens if initial and final time are not specified? Scaled to 0..1? In that case, give the parameters default constructors.
# and oldest tested versions of CMake. This will ensure | ||
# you pick up the best policies. | ||
cmake_minimum_required(VERSION 3.0.0) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to specify C++ language standard and compiler flags
Eigen::MatrixXd _cpts; | ||
|
||
public: | ||
BeBOT() = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default constructor doesn't instantiate cpts, t0 and tf -> undefined behaviour bonanza. Make one constructor BeBOT(const Eigen::Ref<Eigen::MatrixXd>& cpts, const double t0=0, const double tf=1);
#include <Eigen/Dense> | ||
|
||
namespace bebot { | ||
class BeBOT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BeBOT is the name of the library but you probably don't want to name this class that. Maybe something like bebot::ControlProblem
(this class describes a control problem to solve) or bebot::TrajectorySolver
(this class solves for your trajectory), etc
|
||
# # Link each target with other targets or add options, etc. | ||
|
||
# #include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, just uncomment this and get rid of bebot subdirectory within include
{3, 4, 6, 4, 7, 9} | ||
}; | ||
|
||
bebot::BeBOT c(cpts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where possible, prefer {} initialization. It's safer and avoids the most vexing parse.
No description provided.